package com.yonyou.cn.mongodbtest.constant;

/**
 * @ClassName: MongodbEnum
 * @Description: 操作常量类
 * @author likun
 * @date 2019-05-28 15:32
 *
 */
public class MongodbConst {
	
	/**
	 * _显示聚合字段
	 */
	public static final Integer PROJECT_SHOW = 1;
	
	/**
	 *  _隐藏聚合字段
	 */
	public static final Integer PROJECT_HIDE = 0;
	
	
	public static enum AggregateOperEnum{
		OPER_MATCH("match","$match"),
		OPER_GROUP("group","$group"),
		OPER_PROJECT("project","$project"),
		OPER_SORT("sort","$sort"),
		OPER_GROUP_AGAIN("groupAgain","$group"),
		OPER_LIMIT("limit","$limit"),
		OPER_SKIP("skip","$skip"),
;

		private String key;
		
		private String value;

		AggregateOperEnum(String key, String value) {
			this.key = key;
			this.value = value;
		}

		public String getKey() {
			return key;
		}

		public String getValue() {
			return value;
		}

	}
	
	public static enum GroupType{
		
		GROUP_SUM("sum","$sum"),
		GROUP_MIN("min","$min"),
		GROUP_MAX("max","$max"),
		GROUP_FIRST("first","$first"),
		GROUP_LAST("last","$last"),
		;
		
		private String key;
		
		private String value;

		GroupType(String key, String value) {
			this.key = key;
			this.value = value;
		}

		public String getKey() {
			return key;
		}

		public String getValue() {
			return value;
		}
	}
	
	/**
	 * @ClassName: SearchSyntax
	 * @Description: 搜索相关语法
	 * @date 2019-06-03 18:43
	 *
	 */
	public static enum SearchSyntax{
		
		M_EQUAL("equal","$eq"),
		M_GT("gt","$gt"),
		M_GTE("gte","$gte"),
		M_LT("lt","$lt"),
		M_LTE("lte","$lte"),
		M_NE("ne","$ne"), 
		M_IN("in","$in"),
		M_NIN("nin","$nin"),
		M_OR("or","$or")
		;
		
		SearchSyntax(String key, String value) {
			this.key = key;
			this.value = value;
		}

		private String key;
		
		private String value;

		public String getKey() {
			return key;
		}

		public String getValue() {
			return value;
		}
		
	}
	
	/**
	 * @ClassName: Sort
	 * @Description: mongodb排序
	 * @author Administrator
	 * @date 2019-06-18 17:12
	 *
	 */
	public static enum Sort {
		
		SX(1,"升序"),
		JX(-1,"降序");
		
		private int key;
		
		private String value;

		Sort(int key, String value) {
			this.key = key;
			this.value = value;
		}

		public int getKey() {
			return key;
		}

		public String getValue() {
			return value;
		}

		
	}
	

}
